<?
session_start();
include_once("secure/connect.php");
include_once("secure/functions.php");
update_rights ($_SESSION['user_id']);
//include_once("inc.routines.php");
//include ("./autoCompletion_module/autoCompletion_config.php"); 
//include ("./autoCompletion_module/autoCompletion_config.php");

//logout
if ($_GET['logout'])
{
session_destroy();
$_SESSION['logged']=FALSE;
$_SESSION['login_message']="la session à été fermée";
}

//Test du login
$login_message="";
if (!$_SESSION['logged'] && $_POST['Submit'])
	{
	test_login($_POST['user'],$_POST['password']);
	}
	

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>DJ-R &quot;<? echo $_SESSION['user'];?>&quot;</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>

<!--<script type="text/javascript" src="./autoCompletion_module/js/autoCompletion_lib.js"></script>
<script type="text/javascript" src="././autoCompletion_module/js/autoCompletion_lib.js"></script
<link rel="stylesheet" type="text/css" href="./autoCompletion_module/css/autoCompletion_style.css">>-->

<link href="css/admin_screen.css" rel="stylesheet" type="text/css" media="screen">

<link href="css/admin_print.css" rel="stylesheet" type="text/css" media="print">
</head>

<body>
<table width="950" height="595" border="0">
  <tr>
    <td height="84" colspan="2"><img src="../images/logositemag.gif" width="250" height="80"></td>
  </tr>
  <tr>
    <td width="100" height="479" align="left" valign="top"><div class="noPrint"><form name="form1" method="post" action="?">
      <p>Clients<br>
          <input name="client" type="text" class="xxpetit" id="client" value="<? echo $_POST['client']; ?>" size="8" maxlength="20"><input name="chercher" type="submit" id="chercher" value="chercher">
<br>
<a href="form.edit_contact.php?add=1" target="_blank">Nouveau</a> <br>
<a href="?search_client_plus=1">++search</a>      </p>
    </form>
      <form name="form1" method="post" action="">
        Location<br>
        <input name="fiche_loc" type="text" class="xxpetit" id="fiche_loc" value="" size="8" maxlength="20">
      <br>
	  <a href="?nv_devis=1&step=1"><img src="../images/new_btn_50.gif" width="50" height="22" border="0"></a><br>
	  <a href="?etat%5B%5D=2&etat%5B%5D=3&loc_etat=filtre"><img Title="<? echo $alt; ?>" alt="<? echo $alt; ?>" src="../images/sortie_btn_50.gif" width="50" height="22" border="0"></a><br>
	  <a href="?etat%5B%5D=4&loc_etat=filtre"><img Title="<? echo $alt; ?>" alt="<? echo $alt; ?>" src="../images/retour_btn_50.gif" width="50" height="22" border="0"></a><br>
	  <a href="?etat%5B%5D=4.5&etat_facture%5B%5D=&loc_etat=filtre"><img Title="<? echo $alt; ?>" alt="<? echo $alt; ?>" src="../images/close_btn_att_50.gif" width="50" height="22" border="0"></a><br>
	  <a href="?etat%5B%5D=5&etat_facture%5B%5D=2&loc_etat=filtre"><img Title="<? echo $alt; ?>" alt="<? echo $alt; ?>" src="../images/close_btn_50.gif" width="50" height="22" border="0"></a><br>
	  <a href="?etat%5B%5D=6&etat_facture%5B%5D=2&loc_etat=filtre"><img Title="Toutes les fiches clôturées" alt="Toutes les fiches clôturées" src="../images/closed_btn_50.gif" width="50" height="22" border="0"></a><br>
	  <a href="?etat%5B%5D=4&etat%5B%5D=4.5&etat%5B%5D=5&etat%5B%5D=6&etat_facture%5B%5D=1&etat_facture%5B%5D=3&etat_facture%5B%5D=5&etat_facture%5B%5D=6&etat_facture%5B%5D=7&etat_facture%5B%5D=8&etat_facture%5B%5D=9&loc_etat=filtre"><img Title="<? echo $alt; ?>" alt="<? echo $alt; ?>" src="../images/sparadrap_btn_50.jpg" width="50" height="22" border="0"></a><br>
      </form>
	  <form action="" method="get">
	  <?
	  dates_select_trois(date("Y-m-d"), (date("Y")-2), (date("Y")+2), "loc_date");
	  ?><input name="loc_date" type="submit" value="GO">
	  </form>
	  <div align="center">
	    <p><a href="?loc_date=<? print date("Y-m-d"); ?>">
	      <? ical(date('Y-m-d')); ?>
	      </a><br>
          <? if ($_SESSION['rights']['compta']['select']) { ?>
	      <a href="?compta=1"><img src="../images/dolar32.gif" Title="Comptabilit&eacute;" alt="Comptabilit&eacute;" width="32" height="32" border="0"></a>
          <a href="?tt_compta=1&cpts=no%20LIKE%20%27100%25%27%20OR%20no%20LIKE%20%27101%25%27"><img src="../images/dolartot32.gif" Title="Totaux comptes" alt="Totaux comptes" width="32" height="32" border="0"></a><br>
		  <? } ?>
          <? if ($_SESSION['rights']['ouverture']['select']) { ?>
          <a href="?openup=1"><img src="../images/open32.gif" Title="Ouvertures" alt="Ouvertures" width="32" height="32" border="0"></a><a href="?heures=1"></a><br>
          <? } ?>
          <? if ($_SESSION['rights']['todo']['select']) { ?>
          <a href="?todo_and_buy=1"><img src="../images/todo32.gif" alt="ToDo &amp; ToBuy" Title="ToDo &amp; ToBuy" width="32" height="32" border="0"></a>
          <? } ?>
          <? if ($_SESSION['rights']['statistiques']['select']) { ?>
		  <a href="?stats=1"><img src="../images/histo.gif" alt="Statistiques" title="Statistiques" width="32" height="32" border="0"></a><br>
          <? } ?>
		  <br>
	    <a href="?modeles=1">Mod&egrave;les</a></p>
	    <p><a href="?agenda_presta=1">Agenda prestations</a><br>
        </p>
	    <p><a href="?logout=1">logout</a>        </p>
	    <p><a href="pop.session.php" target="_blank">Var session</a></p>
	    </p>
	  </div>   </div> </td>
    <td width="801" align="left" valign="top"><div class="mainPrintArea">
<?
//Test du login
if (!$_SESSION['logged'])
	{
	$query_string=$_ENV['QUERY_STRING'];
	?>
    <img src="../images/coffre100.gif">
    <?
	include_once("inc.form.login.php");
	?><?
    }
	
// affichage des contenus
if ($_SESSION['logged'])
	{
	//print $_SESSION['login_message'];
	$_SESSION['login_message']=FALSE;
	
	//
	//desactiviation de force
	if ($_POST['id_desact'])
		{
		if (!desactive_fiche($_POST['id_desact'])) echo 'impossible de désactiver la fiche '.$_GET['id_desact'].'<br>';
		}
	if ($_GET['id_desact'])
		{
		if (!desactive_fiche($_GET['id_desact']))echo 'impossible de désactiver la fiche '.$_GET['id_desact'].'<br>';
		}
	// recherche de client
	if ($_POST['client'] OR $_GET['client_tri'])
		{
		//recherche et affichage de la liste de clients trouvés
		include_once("inc.liste_clients.php");
		}
	elseif ($_GET['client_found'])
		{
		//affichage de la fiche du client sélectionné //OK
		include_once("inc.client.php"); 
		}
	
	elseif ($_GET['id_fiche_loc'])
		{
		//affichage de la fiche de location concernée //OK
		include_once("inc.edit_fiche.php");
        }
	elseif ($_GET['nv_devis'])
		{
		//affichage de la fiche de location concernée //OK
		include_once("inc.make_devis.php");
        }
	elseif ($_GET['see_all_loc'] || $_GET['loc_etat'] || $_GET['loc_date'] || $_POST['fiche_loc'])
		{
		//affichage de la fiche de location concernée //OK
		include_once("inc.loc_liste.php");
        }
	elseif ($_GET['compta'])
		{
		//affichage de la fiche de location concerné //OK
	
		if ($_SESSION['rights']['compta']['select']) 
			{
			include_once("inc.compta.php");
			}
		else echo "no access";
		}
	elseif ($_GET['compta_compte'])
		{
		//affichage de la fiche de location concerné -- OK
		if ($_SESSION['rights']['compta']['select']) 
			{
            include_once("inc.compta_compte.php");
			}
		}
	elseif ($_GET['tt_compta'])
		{
		//affichage de la fiche de location concerné -- OK
		include_once("inc.totaux_cpts.php");
		}
	elseif ($_GET['search_client_plus'])
		{
		//affichage de la fiche de location concerné -- ok
		include_once("inc.search_client_plus.php");
		}
	elseif ($_GET['openup'])
		{
		//affichage de la fiche de location concerné -- dessus
		include_once("inc.openup.php");
		}
	elseif ($_GET['heures'])
		{
		//affichage de la fiche de location concerné
		include_once("inc.heures.php");
		}
	elseif ($_GET['todo_and_buy'])
		{
		//affichage de la fiche de location concerné
		include_once("inc.todo_and_buy.php");
		}
	elseif ($_GET['modeles'])
		{
		//affichage de la fiche de location concerné
		include_once("inc.modeles.php");
		}
	elseif ($_GET['cloture_mois'])
		{
		//affichage de la fiche de location concerné
		include_once("inc.cloture_mois.php");
		}
	elseif ($_GET['stats'])
		{
		//affichage de la fiche de location concerné
		include_once("inc.stats.php");
		}
		elseif ($_GET['agenda_presta'])
		{
		//affichage de la fiche de location concerné
		include_once("inc.agenda_presta.php");
		}
		



	}

?>

<? //print_r ($_SESSION); ?><? //print_r ($_POST); ?><? //print_r ($_GET); ?></div></td>
  </tr>
  <tr>
    <td height="22" colspan="2">&copy; <? echo date('Y'); ?> DJ-R tous droits r&eacute;serv&eacute;s </td>
  </tr>
</table>

		<!--<form action="#" name="autoCompletion" onSubmit="return false;">
			<div id="autoCompletion_input">
			  <input id="list0" type=text size=50 name="autoCompletion_input" onMouseOver="give_focus_style(0,1);" onBlur="focus_off();" onFocus="focus_on();" onKeyUp="event_capture(this.value,event);">
			</div>
			<div id="autoCompletion_answer" onClick="focus_on();"></div>
		</form>-->
		
<br>

</body>
</html>
